using System;
using System.Windows.Controls;
using System.Windows.Input;

using Winforms = System.Windows.Forms;

namespace ExampleApplication
{
    public partial class MainWindow : System.Windows.Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void UrlTextBox2D_Loaded(object sender, System.Windows.RoutedEventArgs e)
        {
            Winforms.WebBrowser browser = (Winforms.WebBrowser)_WebBrowserHost2D.ContentControl;
            if (browser.Url == null)
             browser.Url = new Uri(((TextBox)e.Source).Text);
        }

        private void UrlTextBox2D_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
        {
            if (e.Key == Key.Return)
            {
                Winforms.WebBrowser browser = (Winforms.WebBrowser)_WebBrowserHost2D.ContentControl;
                browser.Url = new Uri(((TextBox)e.Source).Text);
            }
        }
    }
}